package com.zrrd._01_servlet.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;

/**
 * @author WanJl
 * @version 1.0
 * @title RequestDemo03
 * @description
 * @create 2024/1/13 10:37
 */
@WebServlet("/RequestDemo03")
public class RequestDemo03 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取post请求的请求体
        //1.获取字符输入流
        BufferedReader br = req.getReader();
        //2.读取数据
        String readLine = br.readLine();
        //输出数据....
        System.out.println(readLine);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }
}
